#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int a, b, c, i, count = 0;
	for (i = 10; i <= 1993; i++)
	{
		a = i;
		b = 0;
		while (a != 0)
		{
			c = a % 10;
			b = b * 10 + c;
			a = a / 10;
		}
		if (b == i)
		{
			printf("%-5d", i);
			count++;
			if (count % 5 == 0)
				printf("\n");
		}
	}
	return 0;
}